package com.cloudea.lotus;

import java.util.HashMap;
import java.util.Map;

public class Request {
    private String path = "";
    private Map<String, String> args = new HashMap<String, String>();

    public Request(String path) {
        this.path = path;
    }

    public Request(String path, Map<String, String> args) {
        this.path = path;
        this.args = args;
    }

    public void setParameter(String key, String val){
        args.put(key, val);
    }

    public String getParameter(String key){
        return args.get(key);
    }

    public Map<String, String> getParameters(){
        return args;
    }

    public String getId(){
        String[] frags = path.split("/", 3);
        if(frags.length != 3){
            return "";
        }else {
            return frags[2];
        }
    }
}
